// 通过 abstract 关键字声明一个抽象类
abstract class Package {
    constructor (public weight: number) {}
    // 抽象方法
    abstract calculate():number
    // 具体方法
    printPackge() {
        console.log(`包裹的重量为：${this.weight},运费为：${this.calculate()}元`)
    }
}

class SatnderdPackage extends Package {
    constructor(weight, public price: number) {
        super(weight)
    }
    calculate(): number {
        return this.weight * this.price
    }
}


const s1 = new SatnderdPackage(40, 5)
s1.printPackge()